
/**
 * routerName
 * key|val
 * 键|值
 * 定义的key|路由的name
 */
const routerName = {
    'home':'allocation',
    'homeAdd':'allocationAdd',
    'info':'allocationDetail',
    'infoAdd':'allocationDetailForm',
    'materialDetail':'materialDetail',
    'materialSelect':'materialSelect',
    'batch':'batch',
    'addRefType':'addRefType',
    'allocationAddDetil': 'allocationAddDetil',
}
/**
 * config map结构
 * 键|值
 * 当前页面路由的name|所对应回退的路由name
 */
const config = new Map()
config.set(routerName.homeAdd,routerName.home)
config.set(routerName.info,routerName.home)
config.set(routerName.infoAdd,routerName.info)
// config.set(routerName.materialSelect,routerName.infoAdd)
config.set(routerName.materialDetail,routerName.info)
config.set(routerName.batch,routerName.materialDetail)
config.set(routerName.addRefType,routerName.homeAdd)
config.set(routerName.allocationAddDetil,routerName.home)

const state = {
    routerQuery: {},
    config:config,
    refOderList:{}
}

const mutations = {
    SET_ROUTEQUERY:(state,val)=>{
        state.routerQuery[val.to.name] = Object.keys(val.to.query).length > 0 ? val.to.query :{}
        console.log(state.routerQuery)
    },
    SET_REFORDERNO:(state,val)=>{
        state.refOderList = val
    }
}

const actions = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

